﻿@using VirtualPress.Infrastructure.Entities.Entity;
@using VirtualPress.Tool.Framework;
@{
    ViewBag.Title = "我要投稿";
    Layout = "/Areas/WorkSpace/Views/Shared/_WorkSpace.cshtml";
}
@section head{
    <style type="text/css">
        .journal
        {
            width: 70%;
            margin-left: 150px;
            overflow: hidden;
        }
        .journalitem
        {
            text-align: center;
            padding: 10px;
            overflow: hidden;
            margin: 10px 30px 15px 30px;
            float: left;
        }
        .journalitem a
        {
            width: 110px;
            height: 165px;
            display: block;
            margin-left: auto;
            margin-right: auto;
            padding: 5px;
            box-shadow: 0 0 4px rgb(204, 204, 204);
            border-radius: 2px;
        }
        .journalitem a:hover
        {
            box-shadow: 0 0 6px gray;
        }
        .journalitem a.selected
        {
            box-shadow: 0 0 8px #3a87ad;
        }
        .triangle-icon
        {
            float: right;
            margin-top: -30px;
        }
    </style>
}
<div id="content-header">
    <h1>
        我要投稿</h1>
</div>
<div id="breadcrumb">
    <a href="/WorkSpace/Member" class="tip-bottom"><i class="icon-home"></i>起始页</a>
    <a href="javascript:">期刊投稿</a> <a href="javascript:" class="current">选择期刊</a>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon"><i class="icon-align-justify"></i></span>
                    <h5>
                        选择期刊</h5>
                </div>
                <div class="widget-content nopadding">
                    <form id="cjform" action="/workspace/member/choosejournal" method="post" class="form-horizontal">
                    <input type="hidden" name="Journal" />
                    <div class="control-group">
                        <div class="alert alert-info" style="margin: 10px 20px 10px 20px;">
                            <button type="button" class="close" data-dismiss="alert">
                                &times;</button>
                            <strong>提示!</strong> 请先选择行业分类，再选择行业期刊，选定期刊后点击"<strong>前往投稿</strong>"按钮进行投稿！
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            行业分类</label>
                        <div class="controls">
                            <select id="sltIndType" name="IndType" onchange="queryjournals(this)">
                            </select>
                        </div>
                    </div>
                    <div id="journalcontainer">
                        <div class="journal">
                            @{
                                ItemListBox<Periodical> data = ViewBag.Journals;
                                if (data != null)
                                {
                                    List<Periodical> journals = data.Data;
                                    foreach (var item in journals)
                                    {
                                <div class="journalitem">
                                    <a href="javascript:;" onclick="selectthis(this,@item.Id)">
                                        <img src="@item.CoverImg" alt="@item.Name" style="width: 105px; height: 130px" />
                                        <div style="margin-top: 10px; margin-bottom: 10px; text-align: left">
                                            @item.Name</div>
                                    </a>
                                </div>
                                    }
                                }
                            }
                        </div>
                    </div>
                    <div class="form-actions">
                        <input type="submit" class="btn btn-primary btn-large" value="前往投稿" />
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript" src="/Scripts/plug.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#likcontribute').addClass('active open');
            $('#cjform').submit(function () {
                var id = $('input:hidden[name="Journal"]').val();
                if (id && id > -1) {
                    return true;
                }
                alert('请选择期刊');
                return false;
            });
        });
        new plug.Control().BuildSelect({ element: 'sltIndType', defaultvalue: '@ViewBag.IndType' }, 'profession');
        function selectthis(sender,id) {
            $(sender).parent().siblings('.journalitem').each(function () {
                $(this).children('a').removeClass('selected');
                $(this).children('a').children('.triangle-icon').remove();
            });
            $(sender).addClass('selected');
            $(sender).append($(' <div class="triangle-icon"><span class="label label-success"><i class="icon-ok icon-white"></i></span></div>'));
            $('input:hidden[name="Journal"]').val(id);
        }
        function queryjournals(sender) {
            var indtype = $(sender).val();
            window.location.href = '/workspace/member/choosejournal?indtype=' + indtype + '&page=@ViewBag.Page';
        }
    </script>
}
